package com.qiangesoft.blog.controller.manage;

import com.qiangesoft.blog.common.annotation.OperationLog;
import com.qiangesoft.blog.common.mvc.PageQuery;
import com.qiangesoft.blog.common.mvc.PageResultVO;
import com.qiangesoft.blog.common.result.ResponseResult;
import com.qiangesoft.blog.core.entity.BlogComment;
import com.qiangesoft.blog.core.pojo.vo.SystemCommentVO;
import com.qiangesoft.blog.core.service.IBlogCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 评论管理 前端控制器
 * </p>
 *
 * @author qiange
 */
@RestController
@RequestMapping("/system/comment")
@Api(tags = "评论管理")
@RequiredArgsConstructor
public class BlogCommentController {

    private final IBlogCommentService commentService;

    @GetMapping(value = "/list")
    @ApiOperation(value = "评论列表")
    public PageResultVO<SystemCommentVO> list(@Validated PageQuery pageQuery, String keywords) {
        return commentService.listComment(pageQuery, keywords);
    }

    @DeleteMapping(value = "/deleteBatch")
    @ApiOperation(value = "批量删除评论")
    @OperationLog(value = "删除评论")
    public ResponseResult deleteBatch(@RequestBody List<Integer> ids) {
        return commentService.deleteBatch(ids);
    }

}
